<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta name="format-detection" content="telephone=no, address=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black-translucent" name="apple-mobile-web-app-status-bar-style">
    <title></title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
    <link href="https://cdn.bootcss.com/jquery-mobile/1.4.5/jquery.mobile.theme.css" rel="stylesheet">

    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>



    <script type="text/javascript">
        /**
         * 加载课题列表数据
         */
       // var appendHTML="<option value='0'>请选择</option>";
         $(function(){
             $.ajax({
                 type:"get",
                 url:"[[@{/meetingtype/list}]]",

                 success:function (msg) {
                     var code=msg.code;
                     if(code=="2003"){
                         var appendHTML="<option value='0'>没有数据</option>"
                         $("#tid").append(appendHTML);

                     }else if(code="2000"){
                         var data=msg.data;
                         for(var i=0;i<data.length;i++){
                             appendHTML+='<option value='+data[i].id+'>'+data[i].name+'</option>';
                         }
                         $("#tid").append(appendHTML);
                     }
                     }

             });
         })


        function showPubDiv() {
            $("#two_line").css("border-top", "5px solid #4E90C7");
            //$("#two_tab").css("color","#777777");
            $("#one_line").css("border-top", "5px solid white");
            //$("#one_tab").css("color","white");
            $("#two").css("display", "none");
            $("#one").css("display", "block");
        }

        function showMyMeetings() {
            var uid=$("#uid").val();
            $("#two_line").css("border-top", "5px solid white");
            $("#one_line").css("border-top", "5px solid #4E90C7");

            $("#one").css("display", "none");
            $("#two").css("display", "block");

            $("#two").empty();
            var mname="学习SpringBoot";
            var remark="备注";
            var dateCurr="时间";
            $.ajax({
                type:"get",
                url:"/meetingpub/selectListMeetingPubByUid",
                data:{"uid":uid},
                success:function (obj) {
                    if(obj.code=="2003"){
                        var appendHtml = "<font style='padding: 10px 10px 10px 15px;display: block;color: #777777;'>没有任何会议</font>";
                        alert(obj.msg);
                    }else{
                        var msgobj=obj.data;
                        var appendHtml = "<font style='padding: 10px 10px 10px 15px;display: block;color: #777777;'>您共发布了"+msgobj.length+"场会议</font>";
                        for(var i=0;i<msgobj.length;i++ ){
                            appendHtml += "<div style='width: 100%;background-color: white;margin-top: -3px;padding:10px 10px 10px 15px;display: inline-block;'>" +
                                "<div style='width: 70%;float: left;' onclick='showMeetingInfo(\"" + 1 + "\");'>" +
                                "<div style='white-space: nowrap;overflow: hidden;text-overflow:ellipsis;display: block;font-size:18px;'>" +
                                msgobj[i].title + "</div>" +
                                "<div style='white-space: nowrap;overflow: hidden;text-overflow:ellipsis;display: block;color: #777777;font-size:16px;padding-top:1px'>" +
                                msgobj[i].meetingType.name + " / " + msgobj[i].ptime + "</div></div>" +
                                "<div style='width: 30%;float: right;'>" +
                                "<button class='able-btn'  onclick='chooseGrabList(\""+msgobj[i].id+"\")'>选择讲者</button></div></div>";
                        }
                        $("#two").append(appendHtml);
                    }
                }
            });

        }
        //选择讲者
        function chooseGrabList(pid) {
              window.location.href="/meetingpub/chooseGrabList?pid="+pid;
        }
        
        
        
        //会议发布
        function subMeetingPub(){


             //

            var ptime=$("#ptime").val();
              if(ptime.length<1){
                   alert("会议召开时间不能为空")
                  return;
              }
            var tid=$("#tid").val();
            if(tid==0){
                alert("请选择课题类别")
                return;
            }
            var title=$("#title").val();
            if(title.length<1){
                alert("会议召开时间不能为空")
                return;
            }
            var remark=$("#remark").val();
            if(remark.length<1){
                alert("会议召开时间不能为空")
                return;
            }
            var dataObj=$("#pubForm").serialize();
       $.ajax({
            type: "post",
           url:"[[@{/meetingpub/meetingPubAdd}]]",
           data: dataObj,
           success:function (obj) {
                alert(obj)
              alert(obj.msg);

           }
       });

        }


    </script>
</head>
<body>

<div data-role="page" id="pageDetail">
    <div style="padding:0px;background-color: #4E90C7;width: 100%;height:40px;line-height:40px;font-size:18px;text-align: center;cursor: pointer;" data-role="none">
        <div style="width: 50%;float: left;color: white;" onclick="showPubDiv();" id="one_tab">
            发布
            <div style="border-right: 1px solid white;float: right;margin-top: 10px;height: 20px;"></div>
        </div>
        <div style="width: 50%;float: left;color: white;" onclick="showMyMeetings();" id="two_tab">我的会议</div>
        <div style="border-top:5px solid white;width: 50%;float: left;" id="one_line"></div>
        <div style="border-top:5px solid #4E90C7;width: 50%;float: left;" id="two_line"></div>
    </div>
    <div id="one" class="ui-body-d ui-content" style="padding:0;display: block;width: 100%;">
        <font style="padding:10px 10px 10px 15px;display: block;color: #777777;">请填写会议相关信息</font>
        <div style="width: 100%;background-color: white;padding:10px 0 10px 0;">

            <form id="pubForm" method="post">
                <input type="text" th:value="${uid}" name="uid" id="uid">
                <div style="padding-right:15px;padding-left:15px">
                    <label for="title" class="font-label">会议名称:</label>
                    <input name="title" id="title" placeholder="请输入会议名称" ></input>
                </div>
                <div  style="padding-right:15px;padding-left:15px">
                    <label for="ptime" class="font-label">会议日期</label>
                    <input type="datetime-local" name="ptime" id="ptime" />
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="tid" class="font-label">类别：</label>
                    <select name="tid" id="tid">

                    </select>
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="zone" class="font-label">讲者区域：</label>
                    <select name="zone" id="zone">
                        <option value="全国" selected="selected">全国</option>
                        <option value="全国">全国</option>
                        <option value="西区">西区</option>
                        <option value="南区">南区</option>
                        <option value="北区">北区</option>

                    </select>
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="remark" class="font-label">备注(选填，100字以内)</label>
                    <textarea name="remark" id="remark" placeholder="请输入会议备注" maxlength="100" class="font-blue input-lightblue" style="box-shadow: none;"></textarea>
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <input type="button" value="发布会议"  onclick="subMeetingPub()" id="btnId" />
                </div>
            </form>
        </div>
    </div>





    <div id="two" class="ui-body-d ui-content" style="padding: 0;display: none;width: 100%;"></div>
</div>
</body>

</html>
